home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / extras / programm / gemfsc20 / gemfsc20.lzh / GNUGEM27 / VDIINQ.C < prev    next >
C/C++ Source or Header  |  1993-03-24  |  7KB  |  355 lines

  1. /*
  2.  *    Vdi inquiry funcs library interface
  3.  *
  4.  *        vq_extnd    extended inquire
  5.  *        vq_color    inquire color rep.
  6.  *        vql_attribute    inquire polyline attribute
  7.  *        vqm_attributes    inquire polymarker atribs
  8.  *        vqf_attributes    inquire fill area atribs
  9.  *        vqt_attributes    inquire text atribs
  10.  *        vqt_extent    inquire text extent
  11.  *        vqt_width    inquire char cell width
  12.  *        vqt_name    inquire face name
  13.  *        vq_cellarray    inquire cell array
  14.  *        vqin_mode    inquire input mode
  15.  *        vqt_fontinfo    get font info
  16.  *
  17.  *            ++jrb    bammi@cadence.com
  18.  *            modified: mj -- ntomczak@vm.ucs.ualberta.ca
  19.  *
  20.  */
  21. /*
  22.  *    Note that at this moment (Sept. 91) Atari modified vqt_name()
  23.  *    interface and a string returned from it has a length 33 with
  24.  *    the 33rd byte serving as a flag.  This should not matter if
  25.  *    your program was allocating this extra byte anyway for a
  26.  *    terminating null, but it may kill you if this space was tight!
  27.  *    THIS IS NOT OFFICIAL yet and it may change!!!
  28.  *
  29.  *******
  30.  *
  31.  *        This is official now (jan 93 SpeedoGDOS docs from atari).
  32.  *        To quote the doc "A new parameter has been added to this function.
  33.  *        It is a flag that indicates whether or not the font in question is
  34.  *        an outline font or bitmap font.  The flag will be contained in
  35.  *        intin[33]; 0 will signify a bitmap font, and 1 will indicate an
  36.  *        outline font."
  37.  */
  38.  
  39. #include "common.h"
  40.  
  41. #ifdef __DEF_ALL__
  42.  
  43. #define L_vq_extnd
  44. #define L_vq_color
  45. #define L_vql_attr
  46. #define L_vqm_attr
  47. #define L_vqf_attr
  48. #define L_vqt_attr
  49. #define L_vqt_exte
  50. #define L_vqt_widt
  51. #define L_vqt_name
  52. #define L_vq_cella
  53. #define L_vqin_mod
  54. #define L_vqt_font
  55.  
  56. #endif /* __DEF_ALL__ */
  57.  
  58.  
  59. #ifdef L_vq_extnd
  60.  
  61. /* vq_extnd extended inquire
  62.  * returns void (results in args)
  63.  */
  64. void vq_extnd(int handle, int flag, int work_out[])
  65. {
  66. #ifndef __MSHORT__
  67.     short *iptr;
  68.     int   *wptr, *end;
  69.  
  70.     _intin[0] = flag;
  71.  
  72.     __vdi__(VDI_CONTRL_ENCODE(102, 0, 1, 0), handle);
  73.  
  74.     wptr = work_out;
  75.     end = wptr + 45;
  76.     iptr = _intout;
  77.     do {
  78.     *wptr++ = *iptr++;
  79.     } while (wptr < end);
  80.     end += 12;
  81.     iptr = _ptsout;
  82.     do {
  83.     *wptr++ = *iptr++;
  84.     } while (wptr < end);
  85. #else
  86.     _intin[0] = flag;
  87.  
  88.     _vdiparams[3] = &work_out[0];
  89.     _vdiparams[4] = &work_out[45];
  90.     __vdi__(VDI_CONTRL_ENCODE(102, 0, 1, 0), handle);
  91.     _vdiparams[3] = &_intout[0];
  92.     _vdiparams[4] = &_ptsout[0];
  93.  
  94. #endif    /* __MSHORT__ */
  95. }
  96. #endif /* L_vq_extnd */
  97.  
  98. #ifdef L_vq_color
  99.  
  100. /* vq_color inquire color rep.
  101.  * returns index or -1 if index out of range
  102.  */
  103. int vq_color(int handle, int index, int flag, int rgb[])
  104. {
  105.     short *wptr;
  106.  
  107.     _intin[0] = index;
  108.     _intin[1] = flag;
  109.  
  110.     __vdi__(VDI_CONTRL_ENCODE(26, 0, 2, 0), handle);
  111.  
  112.     wptr = &_intout[1];
  113.     *rgb++ = *wptr++;
  114.     *rgb++ = *wptr++;
  115.     *rgb   = *wptr;
  116.  
  117.     return (int)_intout[0];
  118. }
  119. #endif /* L_vq_color */
  120.  
  121.  
  122. #ifdef L_vql_attr
  123.  
  124. /* vql_attribute    inquire polyline attribute
  125.  * returns void (results in arg)
  126.  */
  127. void vql_attribute(int handle, int atrib[])
  128. {
  129.     short *wptr;
  130.  
  131.     __vdi__(VDI_CONTRL_ENCODE(35, 0, 0, 0), handle);
  132.  
  133.     wptr = &_intout[0];
  134.     *atrib++ = *wptr++;
  135.     *atrib++ = *wptr++;
  136.     *atrib++ = *wptr;
  137.     *atrib = _ptsout[0];
  138. }
  139. #endif /* L_vql_attr */
  140.  
  141. #ifdef L_vqm_attr
  142.  
  143. /* vqm_attributes    inquire polymarker atribs
  144.  * returns void (result in arg)
  145.  */
  146. void vqm_attributes(int handle, int atrib[])
  147. {
  148.     short *wptr;
  149.  
  150.     __vdi__(VDI_CONTRL_ENCODE(36, 0, 0, 0), handle);
  151.  
  152.     wptr = &_intout[0];
  153.     *atrib++ = *wptr++;
  154.     *atrib++ = *wptr++;
  155.     *atrib++ = *wptr;
  156.     *atrib = _ptsout[1];
  157. }
  158. #endif /* L_vqm_attr */
  159.  
  160. #ifdef L_vqf_attr
  161.  
  162. /* vqf_attributes    inquire fill area atribs
  163.  * returns void (result in arg)
  164.  */
  165. void vqf_attributes(int handle, int atrib[])
  166. {
  167.     short *wptr;
  168.  
  169.     __vdi__(VDI_CONTRL_ENCODE(37, 0, 0, 0), handle);
  170.  
  171.     wptr = &_intout[0];
  172.     *atrib++ = *wptr++;
  173.     *atrib++ = *wptr++;
  174.     *atrib++ = *wptr++;
  175.     *atrib++ = *wptr;
  176. }
  177. #endif /* L_vqf_attr */
  178.  
  179. #ifdef L_vqt_attr
  180.  
  181. /* vqt_attributes    inquire text atribs
  182.  * reurns void (results in arg)
  183.  */
  184. void vqt_attributes(int handle, int atrib[])
  185. {
  186. #ifndef __MSHORT__
  187.     short *wptr;
  188.     int   *end;
  189.  
  190.     __vdi__(VDI_CONTRL_ENCODE(38, 0, 0, 0), handle);
  191.  
  192.     wptr = &_intout[0];
  193.     end  = &atrib[6];
  194.     do {
  195.     *atrib++ = *wptr++;
  196.     } while (atrib < end);
  197.     wptr = &_ptsout[0];
  198.     end += 4;
  199.     do {
  200.     *atrib++ = *wptr++;
  201.     } while (atrib < end);
  202. #else
  203.     _vdiparams[3] = &atrib[0];
  204.     _vdiparams[4] = &atrib[6];
  205.     __vdi__(VDI_CONTRL_ENCODE(38, 0, 0, 0), handle);
  206.     _vdiparams[3] = &_intout[0];
  207.     _vdiparams[4] = &_ptsout[0];
  208. #endif /* __MSHORT__ */
  209. }
  210. #endif /* L_vqt_attr */
  211.  
  212. #ifdef L_vqt_exte
  213.  
  214. /* vqt_extent    inquire text extent
  215.  * returns void (result in arg)
  216.  */
  217. void vqt_extent(int handle, char *str, int extent[])
  218. {
  219.     unsigned char ch;
  220.     short *ptr;
  221.     int   *ept, *end;
  222.  
  223.     ptr = _intin;
  224.     while ( ch = *str++)
  225.     *ptr++ = ch;
  226.  
  227.     __vdi__(VDI_CONTRL_ENCODE(116, 0, (int)(ptr - _intin), 0), handle);
  228.  
  229.     ptr = _ptsout;
  230.     ept = extent;
  231.     end = ept + 8;
  232.     do {
  233.     *ept++ = *ptr++;
  234.     } while (ept < end);
  235. }
  236. #endif /* L_vqt_exte */
  237.  
  238. #ifdef L_vqt_widt
  239.  
  240. /* vqt_width    inquire char cell width
  241.  * returns status (and results in args)
  242.  */
  243. int vqt_width(int handle, int chr,
  244.           int *cw, int *ldelta, int *rdelta)
  245. {
  246.     _intin[0] = chr;
  247.  
  248.     __vdi__(VDI_CONTRL_ENCODE(117, 0, 1, 0), handle);
  249.  
  250.     *cw = _ptsout[0];
  251.     *ldelta = _ptsout[2];
  252.     *rdelta = _ptsout[4];
  253.  
  254.     return (int)_intout[0];
  255. }
  256. #endif /* L_vqt_widt */
  257.  
  258. #ifdef L_vqt_name
  259.  
  260. /* vqt_name inquire face name
  261.  * returns index (name in arg)
  262.  */
  263. int vqt_name(int handle, int element, char *name)
  264. {
  265.     short *wptr, *end;
  266.  
  267.     _intin[0] = element;
  268.  
  269.     __vdi__(VDI_CONTRL_ENCODE(130, 0, 1, 0), handle);
  270.  
  271.     wptr = &_intout[1];
  272.     end  = wptr + 33;        /* 32 string elements + flag */
  273.     do {
  274.     *name++ = *wptr++;
  275.     } while (wptr < end);
  276.     return (int)_intout[0];
  277. }
  278. #endif /* L_vqt_name */
  279.  
  280. #ifdef L_vq_cella
  281.  
  282. /* vq_cellarray     inquire cell array
  283.  * returns void (results in args)
  284.  */
  285. void vq_cellarray(int handle, int pxyarray[], int row_len, int nrows,
  286.           int *el_used, int *rows_used, int *status, int color[])
  287. {
  288.     short *end, *wptr = _ptsin;
  289.  
  290.     end = wptr + 4;
  291.     do {
  292.     *wptr++ = *pxyarray++;
  293.     } while (wptr < end);
  294.     _contrl[7] = row_len;
  295.     _contrl[8] = nrows;
  296.  
  297.     __vdi__(VDI_CONTRL_ENCODE(27, 2, 0, 0), handle);
  298.  
  299.     wptr = _intout;
  300.     end = wptr + (short) nrows * (short) row_len;
  301.     while (wptr < end)
  302.     *color++ = *wptr++;
  303.     *el_used = _contrl[9];
  304.     *rows_used = _contrl[10];
  305.     *status    = _contrl[11];
  306. }
  307. #endif /* L_vq_cella */
  308.  
  309. #ifdef L_vqin_mod
  310.  
  311. /* vqin_mode    inquire input mode
  312.  * returns void (desult in arg)
  313.  */
  314. void vqin_mode(int handle, int dev, int *mode)
  315. {
  316.     _intin[0] = dev;
  317.  
  318.     __vdi__(VDI_CONTRL_ENCODE(115, 0, 1, 0), handle);
  319.  
  320.     *mode = _intout[0];
  321. }
  322. #endif /* L_vqin_mod */
  323.  
  324. /* vqt_fontinfo (alias vqt_font_info)    get font info
  325.  * returns void (results in args)
  326.  */
  327.  
  328. #ifdef L_vqt_font
  329.  
  330. __asm__(".stabs \"_vqt_font_info\",5,0,0,_vqt_fontinfo");
  331.                     /* dept of clean tricks */
  332. void vqt_fontinfo(int handle, int *minade, int *maxade, int distances[],
  333.           int *maxwidth, int effects[])
  334. {
  335.     short *wptr, *end;
  336.  
  337.     __vdi__(VDI_CONTRL_ENCODE(131, 0, 0, 0), handle);
  338.  
  339.     *minade = _intout[0];
  340.     *maxade = _intout[1];
  341.  
  342.     wptr = _ptsout;
  343.     *maxwidth = *wptr++;
  344.     end = wptr + 6;
  345.     do {
  346.     *distances++ = *wptr++;
  347.     *effects++     = *wptr++;
  348.     } while (wptr < end);
  349.     *distances++ = *wptr;
  350.     *distances     = wptr[2];
  351. }
  352. #endif /* L_vqt_font */
  353.  
  354. /* -eof- */
  355.